import request from "@/utils/request";
import type { UserInfoApiResponse } from "./model/loginModel";
enum api {
  login = "/admin/acl/index/login",
  logout = "/admin/acl/index/logout",
  userInfo = "/admin/acl/index/info",
}
/**
 * 用户登录的接口
 * @param username 用户名
 * @param password 密码
 * @returns { token: string }
 */
export const loginApi = (username: string, password: string) => {
  return request.post<any, { token: string }>(api.login, {
    username,
    password,
  });
};

/**
 * 用户登出的接口
 * @returns null
 */
export const logoutApi = () => {
  return request.post<any, null>(api.logout);
};
/**
 * 获取用户信息的接口
 * @returns
 */
export const userInfoApi = () => {
  return request.get<any, UserInfoApiResponse>(api.userInfo);
};
